FROM openjdk:17

ENV APP_NAME mall4cloud-xxx
ENV APP_HOME /root/apps
## 设置 TZ 时区
ENV TZ=Asia/Shanghai
## 设置 JAVA_OPTS 环境变量，可通过 docker run -e "JAVA_OPTS=" 进行覆盖
ENV JAVA_OPTS="-Xms256m -Xmx256m"
ENV SKYWALKING_AGENT="-javaagent:/root/local/skywalking-agent/skywalking-agent.jar -Dskywalking.agent.service_name=${APP_NAME} -Dskywalking.collector.backend_service=192.168.100.103:11800"

RUN mkdir -p "${APP_HOME}"
WORKDIR ${APP_HOME}

COPY target/${APP_NAME}.jar ${APP_HOME}/app.jar

## 启动后端项目
CMD java ${JAVA_OPTS} ${SKYWALKING_AGENT} -Djava.security.egd=file:/dev/./urandom -jar app.jar